package com.fzrskj.cloud.free.consts;

public class CConsts {
	final public static String STR_KEY            = "~omg~";
	final public static String STR_SUCCESS 		  = "success";
	final public static String STR_FAILURE 		  = "failure";

	final public static String JS_TIPS 	   		  = "{\"code\":\"%s\",\"result\":\"%s\",\"msg\":\"%s\"}";
	final public static String JS_CUSTOM  		  = "{\"code\":\"%s\",\"msg\":\"%s\"}";
	final public static String JS_DATA	   		  = "{\"code\":\"%s\",\"result\":\"%s\",\"msg\":\"%s\",\"data\":%s}";
	final public static String JS_PAGE_DATA		  = "{\"code\":\"%s\",\"result\":\"%s\",\"msg\":\"%s\",\"page\":%d,\"pages\":%d,\"pagesize\":%d,\"rows\":%d,\"data\":%s}";
	
	final public static String JS_DOMAIN_DATA		  = "{\"status\":\"%s\",\"message\":\"%s\"}";

	final public static int PAGE_SIZE 			  = 20;
	final public static int PAGE_SIZE_MAX		  = 500;
	final public static int SESSION_EXPIRY  	  = 30;		//minutes of session time out
	final public static int ACCESS_RATE     	  = 1000;   //accessing rate of client
	
	final public static String ACCOUNT_NORMAL	  = "Y";	//account is normal
	final public static String ACCOUNT_NOT_ACTIVE = "N";	//account is inactive
	final public static String ACCOUNT_FROZEN 	  = "E";	//account is inactive
	
	final public static String DOMAIN_MSG001	  = "后缀格式匹配错误";	//account is normal
	final public static String DOMAIN_MSG002	  = "域名级别错误";	//account is normal
	final public static String DOMAIN_MSG003	  = "域名已注册";	//account is normal
	final public static String DOMAIN_MSG004	  = "参数格式不对";	//account is normal
	final public static String DOMAIN_MSG005	  = "参数格式不对";	//account is normal
	final public static String DOMAIN_MSG006	  = "不支持";	//account is normal

	/**
	 * 计价年对应天数.
	 */
	final public static Integer YEAR_DAY = 365;
	/**
	 * 计划月对应天数.
	 */
	final public static Integer MONTH_DAY = 30;

	/**
	 * ftp用户前缀.
	 */
	final public static String FTP_USER_PRE = "ftp";

	/**
	 * mysql用户前缀.
	 */
	final public static String MYSQL_USER_PRE = "my";

	/**
	 * sql server用户前辍.
	 */
	final public static String MSSQL_USER_PRE = "ms";

	/**
	 * 虚拟主机开通默认状态.
	 */
	final public static Integer V_HOST_DEF_STATE = 0;

	/**
	 * 默认系统镜像类型.
	 */
	final public static Integer DEFAULT_OS_IMAGE_TYPE = 1;

	/**
	 * 受控成功默认返回值.
	 */
	final public static String DEFAULT_CLIENT_SUCCESS = "0";

	/**
	 * 受控失败默认返回值.
	 */
	final public static String DEFAULT_CLIENT_FAIL = "-1";

	/**
	 * 受控返回状态字段名称.
	 */
	final public static String CHAR_CLIENT_CALLBACK_STATE = "code";

	/**
	 * 受控返回描述信息字段名称.
	 */
	final public static String CHAR_CLIENT_CALLBACK_MSG = "message";

	/**
	 * 验证码登录Session名称.
	 */
	final public static String CODE_LOGIN_SESSION_NAME = "code:login";

	/**
	 * 手机认证码session name.
	 */
	final public static String CODE_AUTH_MOBILE_SESSION_NAME = "code:auth:mobile";

	/**
	 * 邮箱认证码session name.
	 */
	final public static String CODE_AUTH_EMAIL_SESSION_NAME = "code:auth:email";

	public static String indexOfUserType(int utype){
		switch(utype){
		case 0: return "操作员";
		case 1: return "管理员";
		case 2: return "超级管理员";
		default: return "未知用户类型";
		}
	}

	public static String indexOfUserState(int state){
		switch(state){
		case 0: return "正常";
		case 1: return "停用";
		case 2: return "冻结";
		default: return "未知状态";
		}
	}
	
}